//
//  UIBarButtonItem+JJExtension.swift
//  JJToolSwift
//
//  Created by heihei on 2024/5/8.
//

import Foundation

public extension UIBarButtonItem {
    
    /// 创建一个item
    /// - Parameters:
    ///   - target: 点击item后调用哪个对象的方法
    ///   - action: 点击item后调用target的哪个方法
    ///   - image: 图片
    ///   - highImage: 高亮的图片
    /// - Returns: 创建完的item
    static func creat(target: Any?, action: Selector, image: UIImage, highImage: UIImage) -> UIBarButtonItem {
        let btn = UIButton(type: .custom)
        btn.addTarget(target, action: action, for: .touchUpInside)
        btn.setImage(image, for: .normal)
        btn.setImage(highImage, for: .highlighted)
        btn.size = CGSize(width: 26, height: 26)
        return UIBarButtonItem(customView: btn)
    }
}
